{template 'public/header'}
{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/hyb_o2o/template/public/ygcss.css">
<style type="text/css">
    .yg5_key>div{float: left;line-height: 34px;}

    .store_td1{height: 45px;}

    .store_list_img{width: 60px;height: 60px;}

    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;text-align: center;}

    .yg5_tr2>td{padding: 15px;border: 1px solid #e5e5e5;}

    .yg5_tr1>td{

        border: 1px solid #e5e5e5;
        background-color: #FAFAFA;
        padding: 8px;
        font-weight: bold;

    }

    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
    .check_img{width: 45px;height: 45px;}
    .ygrow{margin-top: 20px;}
    .yghuise{background-color: grey;color: white;}
    .yghuise:hover{background-color: grey;color: white;}
</style>
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>    
    <li {if $op == 'display'} class="active" {/if}><a href="{php echo $this->createWebUrl('youhuiquan',array('op'=>'display'))}">优惠券列表</a></li>
    <li {if $op == 'post'} class="active" {/if}><a href="{php echo $this->createWebUrl('youhuiquan',array('op'=>'post'))}">添加优惠券</a></li>
</ul>
{if $op == "display"}
<div class="main">
    <div class="panel panel-default">
        <table class="yg5_tabel col-md-12">
        <tr class="yg5_tr1">
            <td style="width:100px">排序</td>
            <td>优惠券名称</td>
            <td>优惠券金额</td>
            <td>使用说明</td>
            <td>使用要求</td>
            <td>使用时间段</td>
            <td>操作</td>
        </tr>
        {loop $products $item}
        <tr class="yg5_tr2">
            <td>
                {$item['y_id']}
            </td>
            <td>
                {$item['y_name']}
            </td>
            <td>
                {$item['y_money']}
            </td>
            <td>
                {$item['y_shuoming']}
            </td>
            <td>
                {$item['y_yaoqiu']}
            </td>
            <td>
                {$item['y_starttime']}~{$item['y_endtime']}
            </td>
            <td>
                <a class="btn btn-default btn-sm" href="{php echo $this->createWeburl('youhuiquan', array('y_id' => $item['y_id'], 'op' =>'post'))}"  >
                    <span class="fa fa-pencil"></span>
                    <span class="bianji">编辑
                        <span class="arrowdown"></span>
                    </span>
                </a>
                <a class="btn btn-default btn-sm" href="{php echo $this->createWeburl('youhuiquan', array('y_id' => $item['y_id'], 'op' => 'delete'))}" >
                    <span class="fa fa-trash-o"></span>
                    <span class="bianji">删除
                        <span class="arrowdown"></span>
                    </span>
                </a>
            </td>
        </tr>
        {/loop}
    </table>
    </div>
    <div class="text-right we7-margin-top">
         {$pager}
    </div> 
</div>   
{/if}
{if $op == "post"}
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <div class="panel panel-default ygdefault">
            <div class="panel-heading wyheader">
                添加优惠券
            </div>
            <div class="form-group" style="margin-top: 20px">
                <label for="" class="control-label col-sm-1" >优惠券名称</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <input type="text" id="y_name" name="y_name" value="{$items['y_name']}" class="form-control ng-pristine ng-untouched ng-valid ng-empty"  placeholder="" autocomplete="off">
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">优惠券名称</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >优惠券金额</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <input type="text" id="y_money" name="y_money" value="{$items['y_money']}" class="form-control ng-pristine ng-untouched ng-valid ng-empty"  placeholder="" autocomplete="off">
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">优惠券金额</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >优惠券使用说明</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <input type="text" id="y_shuoming" name="y_shuoming" value="{$items['y_shuoming']}" class="form-control ng-pristine ng-untouched ng-valid ng-empty"  placeholder="" autocomplete="off">
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">优惠券使用说明[建议10字]</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1">优惠券使用要求</label>
                <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <select name="y_yaoqiu" id="y_yaoqiu" class="form-control">
                        <option selected="selected">--请选择--</option>
                        <option value="会员可使用" {if $items['y_yaoqiu']=="会员可使用"}selected{/if} >会员可使用</option>   
                        <option value="普通用户可使用"  {if $items['y_yaoqiu']=="普通用户可使用"}selected{/if} >普通用户可使用</option>   
                        <option value="两者均可使用"  {if $items['y_yaoqiu']=="两者均可使用"}selected{/if} >两者均可使用</option>    
                    </select>
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">优惠券使用要求</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >优惠券使用时间</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    {php echo tpl_form_field_daterange('time',array('start' =>$list['start_time'], 'end' =>$list['end_time']));}
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">优惠券使用时间</div>
           </div>
        <div class="form-group" style="margin-top: 20px;">
            <input type="submit" name="submit" value="提交" class="btn col-lg-3" style="color: white;background-color: #44ABF7;"/>
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
{/if}
<script type="text/javascript">
    $(function(){
        $("#frame-10").show();
        $("#yframe-10").addClass("wyactive");
    })
</script>
{template "common/footer"}